home *** CD-ROM | disk | FTP | other *** search
/ Acorn RISC PD-CD 1 / Acorn RISC PD-CD 1.iso / languages / c / _desklibsm / h / wimp < prev    next >
Encoding:
Text File  |  1993-05-26  |  12.3 KB  |  631 lines

  1.  
  2. #ifndef __dl_wimp_h
  3. #define __dl_wimp_h
  4. #ifndef __dl_core_h
  5. #include "Core.h"
  6. #endif
  7. #define wimp_MAXNAME 12
  8. typedef struct
  9. {
  10.  int x, y;
  11. } wimp_point;
  12. typedef wimp_point wimp_coord;
  13. typedef struct
  14. {
  15.  wimp_point min;
  16.  wimp_point max;
  17. } wimp_rect;
  18. typedef wimp_rect wimp_box;
  19. typedef int window_handle;
  20. typedef int icon_handle;
  21. typedef int task_handle;
  22. #define colour_WHITE 0
  23. #define colour_GREY0 0
  24. #define colour_GREY1 1
  25. #define colour_GREY2 2
  26. #define colour_GREY3 3
  27. #define colour_GREY4 4
  28. #define colour_GREY5 5
  29. #define colour_GREY6 6
  30. #define colour_GREY7 7
  31. #define colour_BLACK 7
  32. #define colour_DARK_BLUE 8
  33. #define colour_YELLOW 9
  34. #define colour_GREEN 10
  35. #define colour_RED 11
  36. #define colour_CREAM 12
  37. #define colour_ARMY_GREEN 13
  38. #define colour_ORANGE 14
  39. #define colour_LIGHT_BLUE 15
  40. #define colour_TRANSPARENT 255 
  41. typedef union
  42. {
  43.  int value;
  44.  struct
  45.  {
  46.  unsigned int wimpcolour : 4;
  47.  unsigned int gcolaction : 3;
  48.  unsigned int foreback : 1;
  49.  unsigned int padding : 24;
  50.  } data;
  51. } wimp_colour;
  52. typedef union
  53. {
  54.  int value;
  55.  struct
  56.  {
  57.  char gcol;
  58.  char red;
  59.  char green;
  60.  char blue;
  61.  } data;
  62. } palette_entry;
  63. typedef struct
  64. {
  65.  palette_entry colour[16];
  66.  palette_entry border;
  67.  palette_entry mouse1;
  68.  palette_entry mouse2;
  69.  palette_entry mouse3;
  70. } palette_block;
  71.  
  72. #define iconbtype_NEVER 0
  73. #define iconbtype_ALWAYS 1
  74. #define iconbtype_AUTOREPEAT 2
  75. #define iconbtype_CLICK 3
  76. #define iconbtype_RELEASE 4
  77. #define iconbtype_DOUBLECLICK 5
  78. #define iconbtype_CLICKDRAG 6
  79. #define iconbtype_RELEASEDRAG 7
  80. #define iconbtype_DOUBLEDRAG 8
  81. #define iconbtype_MENU 9
  82. #define iconbtype_DOUBLECLICKDRAG 10
  83. #define iconbtype_RADIO 11
  84. #define iconbtype_RESERVED1 12
  85. #define iconbtype_RESERVED2 13
  86. #define iconbtype_WRITECLICKDRAG 14
  87. #define iconbtype_WRITABLE 15
  88. #define iconbar_RIGHT -1
  89. #define iconbar_LEFT -2
  90. #define window_ICONBAR -2
  91. #define icon_TEXT 0x00000001 
  92. #define icon_SPRITE 0x00000002 
  93. #define icon_BORDER 0x00000004 
  94. #define icon_HCENTRE 0x00000008 
  95. #define icon_VCENTRE 0x00000010 
  96. #define icon_FILLED 0x00000020 
  97. #define icon_FONT 0x00000040 
  98. #define icon_NEEDSHELP 0x00000080 
  99. #define icon_INDIRECTED 0x00000100 
  100. #define icon_RJUSTIFY 0x00000200 
  101. #define icon_ALLOWADJUST 0x00000400 
  102. #define icon_HALVESPRITE 0x00000800 
  103. #define icon_BUTTONTYPE 0x00001000 
  104. #define icon_SELECTED 0x00200000 
  105. #define icon_SHADED 0x00400000 
  106. #define icon_DELETED 0x00800000 
  107. #define icon_FORECOLOUR 0x01000000 
  108. #define icon_BACKCOLOUR 0x10000000 
  109. #define iconvalid_ALLOW 'A'
  110. #define iconvalid_BORDERTYPE 'R'
  111. #define iconvalid_DISPLAY 'D'
  112. #define iconvalid_FONTCOLOURS 'F'
  113. #define iconvalid_LINESPACE 'L'
  114. #define iconvalid_SPRITENAME 'S'
  115. #define iconborder_PLINTH 0
  116. #define iconborder_SURROUND 1
  117. #define iconborder_OKBUTTON 2
  118. #define iconborder_INDENT 3
  119. typedef union
  120. {
  121.  unsigned int value;
  122.  struct
  123.  {
  124.  unsigned int text : 1;
  125.  unsigned int sprite : 1;
  126.  unsigned int border : 1;
  127.  unsigned int hcentre : 1;
  128.  unsigned int vcentre : 1;
  129.  unsigned int filled : 1;
  130.  unsigned int font : 1;
  131.  unsigned int needshelp : 1;
  132.  unsigned int indirected : 1;
  133.  unsigned int rightjustify : 1;
  134.  unsigned int allowadjust : 1;
  135.  unsigned int halfsize : 1;
  136.  unsigned int buttontype : 4;
  137.  unsigned int esg : 5;
  138.  unsigned int selected : 1;
  139.  unsigned int shaded : 1;
  140.  unsigned int deleted : 1;
  141.  unsigned int foreground : 4;
  142.  unsigned int background : 4;
  143.  } data;
  144. } icon_flags;
  145. typedef struct
  146. {
  147.  char *buffer;
  148.  char *validstring;
  149.  unsigned int bufflen;
  150. } icon_indtext;
  151. typedef struct
  152. {
  153.  const char *name;
  154.  unsigned int *spritearea;
  155.  unsigned int nameisname;
  156. } icon_indsprite;
  157. typedef union
  158. {
  159.  char text[wimp_MAXNAME];
  160.  icon_indtext indirecttext;
  161.  char spritename[wimp_MAXNAME];
  162.  icon_indsprite indirectsprite;
  163. } icon_data;
  164. typedef struct
  165. {
  166.  wimp_box workarearect;
  167.  icon_flags flags;
  168.  icon_data data;
  169. } icon_block;
  170. typedef struct
  171. {
  172.  window_handle window;
  173.  icon_block icondata;
  174. } icon_createblock;
  175. typedef union
  176. {
  177.  struct
  178.  {
  179.  unsigned int hastitle : 1; 
  180.  unsigned int moveable : 1; 
  181.  unsigned int hasvscroll : 1; 
  182.  unsigned int hashscroll : 1; 
  183.  unsigned int autoredraw : 1; 
  184.  unsigned int pane : 1; 
  185.  unsigned int nobounds : 1; 
  186.  unsigned int nobackclose : 1; 
  187.  
  188.  unsigned int scrollrq : 1;
  189.  unsigned int scrollrqdebounced : 1;
  190.  unsigned int realcolours : 1;
  191.  unsigned int backwindow : 1;
  192.  unsigned int hotkeys : 1;
  193.  unsigned int dummy13 : 1;
  194.  unsigned int dummy14 : 1;
  195.  unsigned int dummy15 : 1;
  196.  unsigned int open : 1;
  197.  unsigned int top : 1;
  198.  unsigned int fullsize : 1;
  199.  unsigned int istoggling : 1;
  200.  unsigned int focus : 1;
  201.  unsigned int dummy21 : 1;
  202.  unsigned int dummy22 : 1;
  203.  unsigned int dummy23 : 1;
  204.  unsigned int backicon : 1;
  205.  unsigned int closeicon : 1;
  206.  unsigned int titlebar : 1;
  207.  unsigned int toggleicon : 1;
  208.  unsigned int vscroll : 1;
  209.  unsigned int adjusticon : 1;
  210.  unsigned int hscroll : 1;
  211.  unsigned int newflags : 1; 
  212.  } data;
  213.  int value;
  214. } window_flags;
  215. typedef struct 
  216.  int x : 16; 
  217.  int y : 16; 
  218. } window_minsize;
  219. typedef enum
  220. {
  221.  windowcol_TITLEFORE = 0,
  222.  windowcol_TITLEBACK,
  223.  windowcol_WORKFORE,
  224.  windowcol_WORKBACK,
  225.  windowcol_SCROLLBACK,
  226.  windowcol_SCROLLFORE,
  227.  windowcol_TITLEHILITE
  228. } window_colourindices;
  229. typedef struct
  230. {
  231.  wimp_box screenrect;
  232.  wimp_point scroll;
  233.  window_handle behind;
  234.  window_flags flags;
  235.  char colours[8];
  236.  wimp_box workarearect;
  237.  icon_flags titleflags;
  238.  icon_flags workflags;
  239.  void *spritearea;
  240.  window_minsize minsize;
  241.  icon_data title;
  242.  unsigned int numicons;
  243.  
  244. } window_block;
  245. typedef struct
  246. {
  247.  window_handle window;
  248.  wimp_box screenrect;
  249.  wimp_point scroll;
  250.  window_handle behind;
  251. } window_openblock;
  252. typedef struct
  253. {
  254.  window_openblock openblock;
  255.  window_flags flags;
  256. } window_state;
  257. typedef struct
  258. {
  259.  window_handle window;
  260.  window_block block;
  261. } window_info;
  262. typedef struct
  263. {
  264.  window_handle window;
  265.  wimp_box rect;
  266.  wimp_point scroll;
  267.  wimp_box cliprect;
  268. } window_redrawblock;
  269. typedef struct
  270. {
  271.  window_handle window;
  272.  wimp_box screenrect;
  273. } window_outline;
  274. typedef union
  275. {
  276.  unsigned int value;
  277.  struct
  278.  {
  279.  unsigned int adjust : 1;
  280.  unsigned int menu : 1;
  281.  unsigned int select : 1;
  282.  unsigned int dummy3 : 1;
  283.  unsigned int dragadjust : 1;
  284.  unsigned int dummy5 : 1;
  285.  unsigned int dragselect : 1;
  286.  unsigned int dummy7 : 1;
  287.  unsigned int clickadjust : 1;
  288.  unsigned int dummy9 : 1;
  289.  unsigned int clickselect : 1;
  290.  } data;
  291. } button_state;
  292. typedef struct
  293. {
  294.  wimp_point pos;
  295.  button_state button;
  296.  window_handle window;
  297.  icon_handle icon;
  298. } mouse_block;
  299. typedef struct
  300. {
  301.  int shapenumber;
  302.  char *shapedata;
  303.  unsigned int width;
  304.  unsigned int height;
  305.  wimp_point active;
  306. } pointer_shapeblock;
  307. typedef enum
  308. {
  309.  drag_MOVEWINDOW = 1,
  310.  drag_RESIZEWINDOW,
  311.  drag_SCROLLX,
  312.  drag_SCROLLY,
  313.  drag_FIXEDBOX,
  314.  drag_RUBBERBOX,
  315.  drag_INVISIBLE,
  316.  drag_USERFIXEDBBOX,
  317.  drag_USERRUBBERBOX,
  318.  drag_USERFIXEDNC,
  319.  drag_USERRUBBERNC
  320. } drag_type;
  321. typedef struct
  322. {
  323.  window_handle window;
  324.  drag_type type;
  325.  wimp_box screenrect;
  326.  wimp_box parent;
  327. } drag_block;
  328. typedef union
  329. {
  330.  unsigned int value;
  331.  struct
  332.  {
  333.  unsigned int ok : 1;
  334.  unsigned int cancel : 1;
  335.  unsigned int highlightcancel : 1;
  336.  unsigned int noprompt : 1;
  337.  unsigned int noprefix : 1;
  338.  unsigned int nowait : 1;
  339.  unsigned int closebox : 1;
  340.  } data;
  341. } error_flags;
  342. typedef struct menu_block *menu_ptr;
  343. typedef union
  344. {
  345.  unsigned int value;
  346.  struct
  347.  {
  348.  unsigned int ticked : 1;
  349.  unsigned int dotted : 1;
  350.  unsigned int writable : 1;
  351.  unsigned int notifysub : 1;
  352.  unsigned int dummy3 : 3;
  353.  unsigned int last : 1;
  354.  unsigned int dummy14 : 14;
  355.  unsigned int shaded : 1;
  356.  unsigned int dummy1 : 1;
  357.  unsigned int foreground : 4;
  358.  unsigned int background : 4;
  359.  } data;
  360. } menu_flags;
  361. typedef union
  362. {
  363.  menu_ptr menu;
  364.  window_handle window;
  365.  int value;
  366. } menu_submenu;
  367. typedef struct
  368. {
  369.  menu_flags menuflags;
  370.  menu_submenu submenu;
  371.  icon_flags iconflags;
  372.  icon_data icondata;
  373. } menu_item;
  374. typedef struct menu_block
  375. {
  376.  char title [wimp_MAXNAME];
  377.  char titlefore, titleback, workfore, workback;
  378.  unsigned int width;
  379.  unsigned int height;
  380.  unsigned int gap;
  381.  
  382. } menu_block;
  383. typedef int key_press;
  384. typedef struct
  385. {
  386.  window_handle window;
  387.  icon_handle icon;
  388.  wimp_point offset;
  389.  int height;
  390.  int index;
  391. } caret_block;
  392. typedef struct
  393. {
  394.  caret_block caret;
  395.  key_press code;
  396. } key_block;
  397. typedef enum
  398. {
  399.  message_QUIT = 0,
  400.  message_CLOSEDOWN = 0,
  401.  message_DATASAVE = 1,
  402.  message_DATASAVEACK = 2,
  403.  message_DATASAVEOK = 2,
  404.  message_DATALOAD = 3,
  405.  message_DATALOADACK = 4,
  406.  message_DATALOADOK = 4,
  407.  message_DATAOPEN,
  408.  message_RAMFETCH,
  409.  message_RAMTRANSMIT,
  410.  message_PREQUIT,
  411.  message_PALETTECHANGE,
  412.  message_SAVEDESK,
  413.  message_DEVICECLAIM,
  414.  message_DEVICEINUSE,
  415.  message_DATASAVED,
  416.  message_FILEROPENDIR = 0x400,
  417.  message_FILERCLOSEDIR,
  418.  message_HELPREQUEST = 0x502,
  419.  message_HELPREPLY,
  420.  message_NOTIFY = 0x40040,
  421.  message_MENUWARNING = 0x400C0,
  422.  message_MENUWARN = 0x400C0,
  423.  message_MODECHANGE,
  424.  message_TASKINITIALISE = 0x400C2,
  425.  message_INITTASK = 0x400C2,
  426.  message_TASKCLOSEDOWN = 0x400C3,
  427.  message_CLOSETASK = 0x400C3,
  428.  message_SLOTSIZE = 0x400C4,
  429.  message_SLOTCHANGE = 0x400C4,
  430.  message_SETSLOT = 0x400C5,
  431.  message_TASKNAMERQ,
  432.  message_TASKNAMEIS,
  433.  message_TASKSTARTED,
  434.  message_MENUSDELETED, 
  435.  message_WINDOWINFO = 0x400CC, 
  436.  message_POPUPRQ = 0x46D40, 
  437.  message_POPUPREQUEST = 0x46D40,
  438.  message_POPUPSTATE,
  439.  message_POPUPCLOSED,
  440.  message_PRINTFILE = 0x80140,
  441.  message_WILLPRINT,
  442.  message_PRINTTYPEODD = 0x80145,
  443.  message_PRINTTYPEKNOWN,
  444.  message_PRINTERCHANGE
  445. } message_action;
  446. typedef int message_destinee; 
  447. typedef struct
  448. {
  449.  unsigned int size;
  450.  task_handle sender;
  451.  unsigned int myref;
  452.  unsigned int yourref;
  453.  message_action action;
  454. } message_header;
  455. typedef struct
  456. {
  457.  window_handle window;
  458.  icon_handle icon;
  459.  wimp_point pos;
  460.  int estsize;
  461.  int filetype;
  462.  char leafname[12];
  463. } message_datasave;
  464. typedef struct
  465. {
  466.  window_handle window; 
  467.  icon_handle icon; 
  468.  wimp_point pos;
  469.  int estsize;
  470.  int filetype;
  471.  char filename[212];
  472. } message_datasaveack;
  473. typedef struct
  474. {
  475.  window_handle window;
  476.  icon_handle icon;
  477.  wimp_point pos;
  478.  int size;
  479.  int filetype;
  480.  char filename[212];
  481. } message_dataload;
  482. typedef message_dataload message_dataopen;
  483. typedef struct
  484. {
  485.  char *buffer;
  486.  int buffsize;
  487. } message_ramfetch;
  488. typedef struct
  489. {
  490.  char *buffer; 
  491.  int byteswritten;
  492. } message_ramtransmit;
  493. typedef struct
  494. {
  495.  mouse_block where; 
  496. } message_helprequest;
  497. typedef struct
  498. {
  499.  char text[200];
  500. } message_helpreply;
  501. typedef struct
  502. {
  503.  int filler[5];
  504.  int filetype;
  505.  char filename[212];
  506. } message_print;
  507. typedef struct
  508. {
  509.  int id; 
  510.  wimp_point openpos; 
  511.  int selection[10]; 
  512. } message_menuwarn;
  513. typedef struct
  514. {
  515.  message_header header;
  516.  union
  517.  {
  518.  char bytes [236];
  519.  int words [59];
  520.  message_datasave datasave;
  521.  message_datasaveack datasaveack;
  522.  message_dataload dataload;
  523.  message_dataopen dataopen;
  524.  message_ramfetch ramfetch;
  525.  message_ramtransmit ramtransmit;
  526.  message_helprequest helprequest;
  527.  message_helpreply helpreply;
  528.  message_print print;
  529.  message_menuwarn menuwarn;
  530. #if FALSE
  531.  message_popuprequest popuprequest; 
  532.  message_popupstate popupstate; 
  533. #endif
  534.  } data;
  535. } message_block;
  536. #define wimp_NUMBEROFEVENTS 20
  537. typedef enum
  538. {
  539.  event_ANY = -99, 
  540.  event_NULL = 0,
  541.  event_REDRAW,
  542.  event_OPEN,
  543.  event_CLOSE,
  544.  event_PTRLEAVE,
  545.  event_PTRENTER,
  546.  event_CLICK = 6,
  547.  event_BUTTON = 6,
  548.  event_USERDRAG,
  549.  event_KEY,
  550.  event_MENU,
  551.  event_SCROLL,
  552.  event_LOSECARET,
  553.  event_GAINCARET,
  554.  event_USERMESSAGE = 17,
  555.  event_SEND = 17,
  556.  event_USERMESSAGERECORDED = 18,
  557.  event_SENDWANTACK = 18,
  558.  event_USERMESSAGEACK = 19,
  559.  event_ACK = 19
  560. } event_type;
  561. typedef union
  562. {
  563.  unsigned int value;
  564.  struct
  565.  {
  566.  unsigned int null : 1;
  567.  unsigned int redraw : 1;
  568.  unsigned int open : 1;
  569.  unsigned int close : 1;
  570.  unsigned int ptrleave : 1;
  571.  unsigned int ptrenter : 1;
  572.  unsigned int click : 1;
  573.  unsigned int userdrag : 1;
  574.  unsigned int key : 1;
  575.  unsigned int menu : 1;
  576.  unsigned int scroll : 1;
  577.  unsigned int losecaret : 1;
  578.  unsigned int gaincaret : 1;
  579.  unsigned int dummy13 : 1;
  580.  unsigned int dummy14 : 1;
  581.  unsigned int dummy15 : 1;
  582.  unsigned int dummy16 : 1;
  583.  unsigned int usermessage : 1;
  584.  unsigned int usermessagerecorded : 1;
  585.  unsigned int usermessageack : 1;
  586.  } data;
  587. } event_pollmask;
  588. typedef struct
  589. {
  590.  window_openblock openblock;
  591.  wimp_point direction;
  592. } scroll_rq;
  593. typedef union
  594. {
  595.  caret_block caret;
  596.  key_block key;
  597.  window_openblock openblock;
  598.  message_block message;
  599.  mouse_block mouse;
  600.  wimp_box screenrect;
  601.  int selection[10];
  602.  scroll_rq scroll;
  603.  char bytes [256];
  604.  int words [64];
  605. } event_data;
  606. typedef struct
  607. {
  608.  event_type type;
  609.  event_data data;
  610. } event_pollblock;
  611. typedef struct
  612. {
  613.  char fonts [256];
  614. } font_array;
  615. typedef struct
  616. {
  617.  window_block *buffer;
  618.  char *workfree;
  619.  char *workend;
  620.  font_array *font;
  621.  char *name;
  622.  unsigned int index;
  623. } template_block;
  624. typedef struct
  625. {
  626.  wimp_point mul;
  627.  wimp_point div;
  628. } scale_block;
  629. #endif
  630.